<!--
 * @Author: MiNine
 * @Date: 2020-09-21 11:13:59
 * @LastEditors: 岸舟
 * @LastEditTime: 2020-09-23 20:22:42
 * @Description: 
-->
<template>
<div class="myAside">
    <el-menu default-active="1-4-1" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose" :collapse="isCollapse" background-color="#20222a" text-color="#fff" active-text-color="#ffd04b" :router="true">
        <div class="asideTitle">
            <span v-show="!isCollapse">泓立保险</span>
            <span v-show="isCollapse">泓 立</span>
        </div>
        <el-submenu index="1" v-if="vIf['onlyAdmin']">
            <template slot="title">
                <i class="el-icon-user"></i>
                <span slot="title">用户管理</span>
            </template>
            <el-menu-item-group>
                <el-menu-item index="/system/admin/adduser">新增用户</el-menu-item>
                <el-menu-item index="/system/admin/usersList">用户列表</el-menu-item>
            </el-menu-item-group>
        </el-submenu>

        <el-submenu index="2">
            <template slot="title">
                <i class="el-icon-document-copy"></i>
                <span slot="title">订单管理</span>
            </template>
            <el-menu-item-group>
                <el-menu-item index="/system/insureOrder">保险订单管理</el-menu-item>
            </el-menu-item-group>
        </el-submenu>

        <el-submenu index="3">
            <template slot="title">
                <i class="el-icon-document"></i>
                <span>产品管理</span>
            </template>
            <el-menu-item-group>
                <el-menu-item index="/system/insureProduct/getItems">所有保险产品</el-menu-item>
                <el-menu-item index="/system/insureProduct/AddItem" v-if="vIf['onlyAdmin']">新增保险产品</el-menu-item>
            </el-menu-item-group>
        </el-submenu>

        <el-submenu index="4">
            <template slot="title">
                <i class="el-icon-service"></i>
                <span>理赔管理</span>
            </template>
            <el-menu-item-group>
                <el-menu-item index="/system/ClaimOrder/getClaims">待审核理赔</el-menu-item>
                <el-menu-item index="/system/ClaimOrder/addCompensation">新增理赔</el-menu-item>
            </el-menu-item-group>
        </el-submenu>

        <el-submenu index="5" v-if="vIf['onlyAdmin']">
            <template slot="title">
                <i class="el-icon-s-grid"></i>
                <span>保险分类</span>
            </template>
            <el-menu-item-group>
                <el-menu-item index="/system/insureSort">保险分类管理</el-menu-item>
            </el-menu-item-group>
        </el-submenu>
        <el-submenu index="6">
            <template slot="title">
                <i class="el-icon-connection"></i>
                <span>顾客管理</span>
            </template>
            <el-menu-item-group>
                <el-menu-item index="/system/clients">顾客名单</el-menu-item>
            </el-menu-item-group>
        </el-submenu>
        <el-submenu index="7">
            <template slot="title">
                <i class="el-icon-star-off"></i>
                <span>个人中心</span>
            </template>
            <el-menu-item-group>
                <el-menu-item index="/system/UserCenter/modData">基本资料</el-menu-item>
            </el-menu-item-group>
        </el-submenu>
    </el-menu>
</div>
</template>

<script>
import {
    createNamespacedHelpers
} from "vuex";

const {
    mapState
} = createNamespacedHelpers("publicStore");

export default {
    data() {
        return {
            vIf: {
                onlyAdmin: ["1", "9"].some((item) => item == sessionStorage.permission),
            },
        };
    },
    methods: {
        handleOpen(key, keyPath) {
            // console.log(key, keyPath);
        },
        handleClose(key, keyPath) {
            // console.log(key, keyPath);
        },
    },
    computed: {
        ...mapState(["isCollapse"]),
    },
};
</script>

<style lang="scss" scoped>
.el-menu-vertical-demo:not(.el-menu--collapse) {
    width: 200px;
    min-height: 400px;
}

@import "../../assets/scss/public/myAside.scss";
@import "../../element-variables.scss";
</style>
